Skip to content

[Feature] Update generation module to support creating instance with arrival times, due dates, and deadlines#76

Merged
Pabloo22 merged 8 commits intomainfrom
75-update-generation-module
Sep 11, 2025
Merged

[Feature] Update generation module to support creating instance with arrival times, due dates, and deadlines#76
Pabloo22 merged 8 commits intomainfrom
75-update-generation-module

Conversation

@Pabloo22
Copy link
Copy Markdown
Owner

@Pabloo22 Pabloo22 commented Sep 10, 2025

Adds functional modular_instance_generator and related functions. It also refactors the organization of the module and deprecates the InstanceGenerator interface.

  • Implemented duration matrix generation with validation.
  • Created machine matrix generation functions with and without recirculation.
  • Developed modular instance generator for creating job shop instances.
  • Added release date matrix generation with various strategies.
  • Introduced size selectors for dynamic job and machine counts.
  • Added comprehensive tests for duration matrix, machine matrix, modular instance generator, release date matrix, and size selectors.
  • Removed outdated test file for generation utilities.

Extra:

  • Adds load_benchmark_group function
  • Adds a tutorial
  • Adds properties duration_matrix and duration_matrix_array (deprecates durations_matrix and durations_matrix_array) to JobShopInstance.

…#75)

Adds functional `modular_instance_generator` and related functions. It also refactors the organization of the module and deprecates the `InstanceGenerator` interface.

- Implemented duration matrix generation with validation.
- Created machine matrix generation functions with and without recirculation.
- Developed modular instance generator for creating job shop instances.
- Added release date matrix generation with various strategies.
- Introduced size selectors for dynamic job and machine counts.
- Added comprehensive tests for duration matrix, machine matrix, modular instance generator, release date matrix, and size selectors.
- Removed outdated test file for generation utilities.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Pabloo22, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the library's ability to generate job shop scheduling instances. The core change is the introduction of a highly modular and extensible instance generator, allowing for fine-grained control over instance characteristics like job arrival times and due dates. This enhancement provides greater flexibility for researchers and practitioners to create diverse and realistic problem instances for testing and development.

Highlights

  • Modular Instance Generation: Introduced a new modular_instance_generator function that provides a flexible and composable way to create job shop instances with customizable properties, including arrival times, due dates, and deadlines. This new function replaces the deprecated InstanceGenerator and GeneralInstanceGenerator interfaces.
  • Enhanced Instance Properties: Added support for generating instances with release dates, deadlines, and due dates through dedicated matrix creation functions and various strategies (independent, cumulative, mixed).
  • Refactored Generation Module: The instance generation logic has been significantly refactored into smaller, more focused modules (_duration_matrix.py, _machine_matrix.py, _release_date_matrix.py, _size_selectors.py, _modular_instance_generator.py) for improved maintainability and extensibility.
  • New Tutorial and Documentation Updates: A new tutorial, 'Generating New Problems', has been added to guide users on how to leverage the new modular instance generation capabilities. The README.md and existing tutorials have been updated to reflect these changes and the new file structure.
  • Deprecation of Old Attributes: The durations_matrix and durations_matrix_array attributes in JobShopInstance have been deprecated in favor of duration_matrix and duration_matrix_array for naming consistency.
  • New Benchmark Loading Utility: A load_benchmark_group function has been added to the benchmarking module, allowing users to load multiple benchmark instances that share a common naming prefix.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a comprehensive modular instance generation system for creating job shop instances with support for arrival times, due dates, and deadlines. The PR refactors the generation module organization and deprecates the InstanceGenerator interface.

  • Implements a new modular_instance_generator function with dependency injection for flexible instance creation
  • Adds duration, machine, and release date matrix generation with various strategies and validation
  • Introduces size selectors for dynamic job and machine count selection
  • Updates property naming from durations_matrix to duration_matrix for consistency

Reviewed Changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
job_shop_lib/_job_shop_instance.py Updates property naming from durations_matrix to duration_matrix with backward compatibility
job_shop_lib/generation/ Adds modular generation components including size selectors, matrix creators, and instance generator
job_shop_lib/benchmarking/ Adds load_benchmark_group function for loading benchmark instance groups
tests/ Comprehensive test coverage for new generation functionality and updated property names
docs/ Adds tutorial for generating new problems and updates simulated annealing tutorial

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and valuable refactoring of the instance generation module, making it more modular and extensible. The new modular_instance_generator is a great addition, and the accompanying tutorial is very helpful. The code is well-structured, and the addition of comprehensive tests is commendable.

My review focuses on a few key areas:

  • A critical bug in the machine matrix generation that leads to incorrect instance dimensions.
  • A performance regression in JobShopInstance due to incorrect caching of properties.
  • Minor issues in documentation and code consistency.

Overall, this is a great feature, and with a few fixes, it will be a solid improvement to the library.

Comment on lines +51 to +53
return generate_machine_matrix_with_recirculation(
num_jobs, num_machines, numpy_rng
).tolist()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The generate_machine_matrix_with_recirculation function returns a matrix of shape (num_machines, num_jobs). However, other parts of the generation pipeline, like JobShopInstance.from_matrices, expect a machine matrix of shape (num_jobs, num_machines). This will lead to incorrectly generated instances. The matrix should be transposed before being returned.

Suggested change
return generate_machine_matrix_with_recirculation(
num_jobs, num_machines, numpy_rng
).tolist()
return generate_machine_matrix_with_recirculation(
num_jobs, num_machines, numpy_rng
).T.tolist()

" for d in job_row:\n",
" cum += d\n",
" # 25% slack factor (matches markdown description)\n",
" row.append(int(math.ceil(cum * 2)))\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a discrepancy between the markdown description and the code for calculating deadlines. The markdown states that deadlines are calculated as cumulative_duration * 1.25, but the code uses cum * 2. The comment in the code also refers to a "25% slack factor", which corresponds to multiplying by 1.25, not 2. Please align the code with the description to avoid confusion.

            row.append(int(math.ceil(cum * 1.25)))

Comment on lines +103 to +104
A dictionary containing the names of the benchmark instances as keys
and the corresponding :class:`JobShopInstance` objects as values.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The docstring here states that the function returns a dictionary, but the function signature and implementation indicate it returns a list of JobShopInstance objects. Please update the docstring to match the return type.

Suggested change
A dictionary containing the names of the benchmark instances as keys
and the corresponding :class:`JobShopInstance` objects as values.
A list of :class:`JobShopInstance` objects whose names start with the given
prefix.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 10, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

instead of the deprecated `durations_matrix_array`
…rculation`

Correct machine matrix shape and add validation for job and machine counts
@Pabloo22 Pabloo22 requested a review from Copilot September 11, 2025 16:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

job_shop_lib/generation/_machine_matrix.py:74

  • The docstring states the return shape is (num_machines, num_jobs) but the actual implementation returns shape (num_jobs, num_machines) as seen in line 84. The documentation should be corrected to match the implementation.
        A machine matrix with recirculation with shape (num_machines,
        num_jobs).

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Pabloo22 Pabloo22 merged commit d76d999 into main Sep 11, 2025
10 checks passed
@Pabloo22 Pabloo22 deleted the 75-update-generation-module branch September 11, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Update generation module to support creating instance with arrival times, due dates, and deadlines

3 participants